<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="vue.js" type="text/javascript">
			
		</script>
		<script src="axios.min.js" type="text/javascript">
			
		</script>
	</head>
	<body>
		<div id="app">
			用户名:<input v-model="username" /><br/>
			密码：<input v-model="password" /> <br>
			<button v-on:click="login">登录</button>
		</div>
	</body>
	<script type="text/javascript">
	var config={
		el:"#app",
		data:{
			username:"",
			password:""
		},
		methods:{
			login:function(){
				debugger;
				var serverUrl="http://localhost:1314"
				+"/user/login?"
				+"username="+this.username+
				"&password="+this.password;
				axios.get(serverUrl)
				.then(function(response){
					debugger;
					var dbUser=response.data;
					window.alert(dbUser.userId);
				})
				.catch(function(e){
					window.alert("联网失败");
					console.log(e);
				});
			}
		}
	}	
	var vue=new Vue(config);
	</script>
</html>



